package com.rain.controller;

import com.rain.enums.PageSize;
import com.rain.query.SimplePage;
import com.rain.query.ResponseVO
import com.rain.entity.EtSensorType;
import com.rain.query.EtSensorTypeQuery;
import com.rain.query.PaginationResult;
import com.rain.service.EtSensorTypeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
/**
 * @auther: rain
 * @description: 传感器字典表Controller
 * @date: 2025-10-31
 */

@RestController
@RequestMapping("/etSensorType")
public class EtSensorTypeController extends BaseController {

	@Resource
	private EtSensorTypeService etSensorTypeService;

	@GetMapping
	public ResponseVO list(EtSensorTypeQuery query) {
		return getSuccessResponseVO(etSensorTypeService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@PostMapping
	public ResponseVO add(EtSensorType bean) {

	return getSuccessResponseVO(etSensorTypeService.add(bean));

	}

	/**
	 * 批量新增
	 */
	@PostMapping("/addBatch")
	public ResponseVO addBatch(List<EtSensorType> listBean) {

	return getSuccessResponseVO(etSensorTypeService.addBatch(listBean));

	}

	/**
	 * 批量新增修改
	 */
	@PostMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(List<EtSensorType> listBean) {

	return getSuccessResponseVO(etSensorTypeService.addOrUpdateBatch(listBean));

	}

	/**
	 * 根据Id查询
	 */
	@GetMapping("/{id}")
	public ResponseVO getEtSensorTypeById(@PathVariable Integer id) {

		return getSuccessResponseVO(etSensorTypeService.getEtSensorTypeById(id));

	}

	/**
	 * 根据Id更新
	 */
	@PutMapping("/{id}")
	public ResponseVO updateEtSensorTypeById(@RequestBody EtSensorType bean, @PathVariable Integer id){

		return getSuccessResponseVO(etSensorTypeService.updateEtSensorTypeById(bean, id));

	}

	/**
	 * 根据Id删除
	 */
	@DeleteMapping("/{id}")
	public ResponseVO deleteEtSensorTypeById(@PathVariable Integer id) {

		return getSuccessResponseVO(etSensorTypeService.deleteEtSensorTypeById(id));

	}

}